﻿
namespace UserInterface.Gateways
{
    using System;
    using System.Collections.Generic;
    using System.Configuration;
    using System.Data.Services.Client;
    using System.Linq;
    using UserInterface.AUSRISservice;

    public class TermGateway : ITermGateway
    {

        private AUSRISEntities context;

        public TermGateway()
        {
            Uri serviceUri = new Uri(ConfigurationManager.AppSettings["ServiceUri"]);
            this.context = new AUSRISEntities(serviceUri);
            this.context.MergeOption = MergeOption.AppendOnly;
        }


        public IList<au_Term> GetTerms()
        {
            var terms = from t in this.context.au_Term
                        orderby t.InstructionBeginDate
                        select t;

            return terms.ToList();
        }
    }
}
